package com.mayikt.consumer;


import com.alibaba.fastjson.JSONObject;
import com.mayikt.consumer.bo.NotifyMerchantBO;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


@Component
@Slf4j
@RabbitListener(queues = "fanout_wechatTemplate_queue")
public class WechatTemplateConsumer {

    /**
     * 消费者订阅微信公众号的主题
     */
    @RabbitHandler
    public void process(String msg, Message message, Channel channel) {
        log.info(">>调用微信模板接口发送微信模板提醒:{}<<", msg);
        try {
            long deliveryTag = message.getMessageProperties().getDeliveryTag();
            try {
                NotifyMerchantBO notifyMerchantBO = JSONObject.parseObject(msg, NotifyMerchantBO.class);
              
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
